{include file="common/header" /}
<body>
<head>
 {include file="common/personal_top" /}
<!--用户中心样式-->
<script>
$(function(){
  $('.ord tr input:radio').each(function(){
    $(this).click(function(){
      var conf = confirm('更换地址后，您需要重新确认订单信息');
      if (conf) {
         $(this).parent().parent().addClass('current_addr').siblings().removeClass('current_addr').children('td').removeClass('addr');
        $(this).parent().next('td').addClass('addr');
      }
      id = $(this).val();
      var url = "{:url('order/sel_addr')}";
      data = {'id':id};
      $.post(url,data,function(result){
          if (result.status == 1) {
            seladdr = result.data;
            $('.confirm1 .order-addr span').html(seladdr.pro+' '+seladdr.city+' '+seladdr.detail_address);
            $('.confirm1 .order-user .order-uname').html(seladdr.consigner);
            $('.confirm1 .order-user .order-mobile').html(seladdr.mobile);
            $('.confirm1 input:hidden').val(seladdr.id);
          }else if(result.status == 0){
            alert(result.message);
          }
      },'json')
    })
  })
})
</script>
<div class="orderbox" style="width: 980px;margin: 0 auto;">
<div class=" clear bread" style="padding: 20px 0;font-size: 14px;color:#666;">当前位置：<a href="#">首页</a> <span class="pipe">&gt;</span> 填写核对订单</div>
<div class="cont">
   <div class="carImg"><img src="__STATIC__/index/images/car2.jpg" width="961" height="27" /></div>
   <h4 class="orderTitle">收货地址</h4>
   <table class="ord">
    <tr class="current_addr">
     <td width="20%">
      <input type="radio" name="addr" checked="checked" value="{$default_addr->id}" />
     </td>
     <td class="addr" width="60%">
      {$default_addr->province|getProvince}  {$default_addr->city|getProvince}  {$default_addr->detail_address}({$default_addr->consigner} 收) {$default_addr->mobile}  默认地址
     </td>
     <td>
      <span class="green upd">[修改]</span> | <span class="green add">[添加]</span> 
     </td>
    </tr>
    {volist name="other_addr" id="vo"}
    <tr>
     <td width="20%">
      <input type="radio" name="addr" value="{$vo.id}" /> 
     </td>
     <td width="60%">
      {$vo->province|getProvince}  {$vo->city|getProvince}  {$vo->detail_address}({$vo->consigner} 收)  {$vo->mobile}  
     </td>
     <td>
      <span class="green upd">[修改]</span> | <span class="green add">[添加]</span> 
     </td>
    </tr>
    {/volist}
   </table>
   <h4 class="orderTitle">支付方式</h4>
   <ul class="zhiList">
   <li class="zhistyle">支付宝-余额支付</li>
   <div class="clears"></div>
  </ul> 
  <div class="zhifufangshi" style="display: block;">
   <ul class="yinhang">
    <li><input type="radio" checked="checked" /><img src="__STATIC__/index/images/zhifu1_10.png" /></li>
    <div class="clear"></div>
   </ul>
  </div>
  <h4 class="orderTitle">购物清单</h4>
  <table class="orderList">
      <thead>
        <tr>
          <th width="40%">商品</th>
          <th width="20%">单价</th>
          <th width="20%">数量</th>
          <th width="20%">小计</th>
        </tr>
      </thead>
      <tbody>
        {volist name="order_info" id="vo"}
        <tr>
          <td width="40%" class="goods" style="padding-left: 20px;"><img src="{$vo->picture}" alt=""/><span><a href="{:url('goods/goods_detail',['id'=>$vo.gid])}">{$vo.gname}</a></span></td>
          <td width="20%" class="price">{$vo->price}</td>
          <td width="20%" class="count">{$vo->num}</td>
          <td width="20%" class="subtotal">{$vo.total_price}</td>
        </tr>
        {/volist}
      </tbody>

    </table>
    <div class="sum">合计：<strong>￥{$sum}</strong></div>
    <div class="confirm1">
      <div class="order-paymoney">
        实付款：<strong>￥{$sum}</strong>
      </div>
      <div class="order-addr">
        <strong>寄送至：</strong><span>{$default_addr->province|getProvince}  {$default_addr->city|getProvince}  {$default_addr->detail_address}</span>
      </div>
      <div class="order-user">
        <strong>收货人：</strong><span class="order-uname">{$default_addr->consigner}</span> <span class="order-mobile">{$default_addr->mobile}</span>
      </div>
      <input type="hidden" value="{$default_addr.id}">
    </div>
    <div style="clear:both;"></div>
    <div class="button"><button>提交订单</button></div>
   <div class="clears"></div>
  </div>
</div>
<script>
$(function(){
  $('.button button').click(function(){
      var aid = $('.confirm1 input:hidden').val();
      var order_no = {$order_no};
      var url = "{:url('order/order_submit')}";
      var data = {'aid':aid,'order_no':order_no};
      $.post(url,data,function(result){
          if (result.code == 1) {
            location.href = result.data;
          } else if(result.code == 0){
            alert(result.msg);
          }
      },'json');
  })
})
</script>
{include file="common/footer" /}
</body>
</html>
